package total;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Ques1343 {
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		int n;
		int[] arr = new int[32768];
		int time;
		for(int i = 2;i < 32768;i ++ ){
			for(int j = i * 2;j < 32768;j += i){
				arr[j] ++;
			}
		}
		List<Integer> list = new ArrayList<>();
		while(scan.hasNext()){
			n = scan.nextInt();
			time = 0;
			if(n == 0){
				for(int i : list){
					System.out.println(i);
				}
				continue;
			}
			for(int i = 2;i <= n / 2;i++){
				if(arr[i] == 0 && arr[n - i] == 0){
					time++;
				}
			}
			list.add(time);
		}
	}
	
	public static void main(String[] args) {
		new Ques1343().go();
	}
}
